package com.beetlestech.nfe.main.biz.com.impl;

import java.util.ArrayList;
import java.util.List;

import com.beetlestech.nfe.fw.core.biz.AbstractDBLogic;
import com.beetlestech.nfe.main.biz.com.HbActivitiesImage;
import com.beetlestech.nfe.main.biz.com.dto.ActivitiesImageInfoDTO;
import com.beetlestech.nfe.main.biz.constant.CommonConstant;
import com.beetlestech.nfe.main.biz.constant.CtgCodeConstant;
import com.beetlestech.nfe.main.biz.constant.HbMessageCode;
import com.beetlestech.nfe.main.db.base.StatementDTO;
import com.beetlestech.nfe.main.db.base.StatementUtil;
import com.beetlestech.nfe.main.db.constant.SQLConstant;
import com.beetlestech.nfe.main.db.view.VactivitiesimageDTO;
import com.beetlestech.nfe.main.db.view.VcourseDTO;

public class HbActivitiesImageImpl extends AbstractDBLogic implements HbActivitiesImage, CtgCodeConstant, HbMessageCode, CommonConstant, SQLConstant {
	
	@Override
	public ActivitiesImageInfoDTO[] getActivitiesImage(Integer type) {
		List<ActivitiesImageInfoDTO> imageList = new ArrayList<ActivitiesImageInfoDTO>();
		StatementDTO statementDTO = new StatementDTO();
		if(type==1 || type==2){
			StatementUtil.andWhere(statementDTO, VactivitiesimageDTO.COLUMN_TYPE, 
				StatementUtil.KEYWORD.EQUAL, type);
		}
		VactivitiesimageDTO vactivitiesimageDTO=new VactivitiesimageDTO();
		vactivitiesimageDTO.set_dynamicWhereCondition(statementDTO.getSQLStatement());
		List<VactivitiesimageDTO> Vactivitiesimages = queryDAO.queryForObjectList(VactivitiesimageDTO.SQL_SEARCH, vactivitiesimageDTO);
		for(VactivitiesimageDTO item : Vactivitiesimages){
			ActivitiesImageInfoDTO activities = new ActivitiesImageInfoDTO();
			activities.setPath(item.getpath());
			activities.setlink(item.getLINK());
			activities.setactivitiesid(item.getactivitiesid());
			imageList.add(activities);
		}

		return imageList.toArray(new ActivitiesImageInfoDTO[imageList.size()]);
		  
		
	}

}
